<?php
// No direct access to this file
defined('_JEXEC') or die( 'Restricted access' );

jimport( 'joomla.application.component.view');

class ManagerViewRole extends JView {
	
	var $table = null;
	
    function __construct() {
        ManagerHelper::showMenuPim("rolepim");
        $this->table =& JTable::getInstance('Role', 'Table');	 

        parent::__construct();
    }	
    
	function display() {
		$mainframe = JFactory::getApplication();
        $this->setLayout('display');
        
        ManagerHelper::showToolBar('Role Management', false, false);
        						
        $limit				= $mainframe->getUserStateFromRequest( 'roles.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
        $limitstart 		= $mainframe->getUserStateFromRequest( 'roles.limitstart', 'limitstart', 0, 'int' );
        $filter_order		= $mainframe->getUserStateFromRequest( 'roles.filter_order', 'filter_order', 'id', 'cmd' );
        $filter_order_Dir	= $mainframe->getUserStateFromRequest( 'roles.filter_order_Dir', 'filter_order_Dir', ManagerHelper::ORDER_DIR, 'word' );

        $Model = JModel::getInstance('Role', 'PimModel');
        $Model->getData($total, $dbrow, $filter_order, $filter_order_Dir, $limitstart, $limit);
		
        jimport('joomla.html.pagination');
        $pageNav = new JPagination( $total, $limitstart, $limit );
       
        $this->assign('TOTAL_ROW', $total);
        $this->assign('dbrow', $dbrow);
        $this->assign('LIST_FOOTER_PAV', $pageNav->getListFooter());
        $this->assign('FORM_ORDER', $filter_order);
        $this->assign('FORM_ORDER_DIR',$filter_order_Dir);
      
        parent::display();
    }
    
 	function addForm() {		
		$mainframe = JFactory::getApplication();
		$this->setLayout('form');					
		$cid = JRequest::getVar('cid');
	    
        if(!empty($cid)) {
        	$Model = JModel::getInstance('Role', 'PimModel');
        	$rows = $Model->getLoadObj($cid[0]);
			$this->assign('rows', $rows);
		}		
		
		parent::display();
    }
}
